// with polyfills
import 'core-js/stable'
import 'regenerator-runtime/runtime'

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store/'
import i18n from './locales'
import { VueAxios } from './utils/request'
import ProLayout, { PageHeaderWrapper } from '@ant-design-vue/pro-layout'
import themePluginConfig from '../config/themePluginConfig'

import bootstrap from './core/bootstrap'
import './core/lazy_use' // use lazy load components
import './permission' // permission control
import './utils/filter' // global filter
import './global.less' // global style
import * as net from './api/net'
import * as api from './api/api'
import * as utils from './utils/util'

import dw from 'daowey-vueweb'
Vue.use(dw)

import storage from 'store'

Vue.prototype.$cache = storage;
Vue.prototype.$net = {...net,...api};
Vue.prototype.$utils = utils;

api.getConfig()
.then(res=>{
	const use = res.use;
	const configData = res[use];
	storage.set('configData',configData)
	storage.set('baseURL',configData['url']);
})

Vue.config.productionTip = false

// mount axios to `Vue.$http` and `this.$http`
Vue.use(VueAxios)

Vue.component('pro-layout', ProLayout)
Vue.component('page-container', PageHeaderWrapper)
Vue.component('page-header-wrapper', PageHeaderWrapper)

window.umi_plugin_ant_themeVar = themePluginConfig.theme

new Vue({
  router,
  store,
  i18n,
  created: bootstrap,
  render: h => h(App)
}).$mount('#app')
